import { _axios } from './request.js'

// 频道新闻推荐
function channels () {
  return _axios({
    url: 'v1_0/channels'
  })
}
// 获取对应频道新闻
function articles (id) {
  return _axios({
    url: 'v1_1/articles',
    params: {
      channel_id: id,
      timestamp: 1556789000001 + parseInt(Math.random() * 99),
      with_top: 1
    }
  })
}
// 获取用户频道列表
function userChannels (choose) {
  return _axios({
    url: 'v1_0/user/channels',
    needToken: choose
  })
}
// 用户修改收藏频道
function alterUserChannels (data) {
  return _axios({
    url: 'v1_0/user/channels',
    method: 'put',
    needToken: true,
    data
  })
}
export { channels, articles, userChannels, alterUserChannels }
